from django.conf.urls import url

from meiduo_admin.views import categories
from meiduo_admin.views import groups
from meiduo_admin.views import images
from meiduo_admin.views import skus
from meiduo_admin.views import specs
from meiduo_admin.views import spus
from meiduo_admin.views import users, orders, permissions, admins
from . import views
from .views import statistical
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', statistical.TotalView.as_view()),
    url(r'^statistical/day_increment/$', statistical.IncrementView.as_view()),
    url(r'^statistical/day_active/$', statistical.ActiveView.as_view()),
    url(r'^statistical/day_orders/$', statistical.OrdersView.as_view()),
    url(r'^statistical/month_increment/$', statistical.MonthView.as_view()),
    url(r'^statistical/goods_day_views/$', statistical.GoodsView.as_view()),
    url(r'^users/$', users.UsersView.as_view()),
    # url(r'^goods/specs/$', specs.SpecsView.as_view()),
    # url(r'^goods/specs/(?P<pk>\d+)/$', specs.SpecView.as_view()),
    url(r'^goods/simple/$', spus.SPUSimpleView.as_view()),
    url(r'^skus/categories/$', categories.CategoryView.as_view()),
    url(r'^goods/(?P<pk>\d+)/specs/$', specs.SpecBySPUView.as_view()),
    url(r'^permission/perms/$', permissions.PermissionView.as_view()),
    url(r'^permission/simple/$', permissions.PermissionSimpleView.as_view()),

]

router = DefaultRouter()
router.register('goods/specs', specs.SpecsModelView, base_name='specs')
router.register('skus/images', images.ImagesView, base_name='images')
router.register('skus', skus.SkuModelViewSet, base_name='skus')
router.register('orders', orders.OrderView, base_name='orders')
router.register('permission/groups', groups.GroupView, base_name='groups')
router.register('permission/admins', admins.AdminsView, base_name='admins')

urlpatterns += router.urls
